home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / human interface toolbox / auntiedialog / appearancehelpers.c next >
Encoding:
Text File  |  2000-06-23  |  1.6 KB  |  65 lines

  1.     //
  2.     //    LEGAL NOTICE
  3.     //    ============
  4.     //
  5.     //     You may incorporate this sample code into your applications
  6.     //     without restriction. This sample code has been provided "AS
  7.     //     IS" and the responsibility for its operation is 100% yours.
  8.     //     You are not permitted to redistribute the source as "Apple
  9.     //     sample code" after having made changes. If you're going to
  10.     //     re-distribute the source, we require that you make it clear
  11.     //     in the source that the code was descended from Apple sample
  12.     //     code, but that you've made changes.
  13.     //
  14.  
  15. #import "AppearanceHelpers.h"
  16. #import <ControlDefinitions.h>
  17. #import "Assertions.h"
  18.  
  19. #define MIN( a, b )        ( ( (a) < (b) ) ? (a) : (b) )
  20.  
  21. pascal OSStatus SetProgressIndicatorState( ControlHandle control, Boolean isDeterminate )
  22. {
  23.     OSStatus    err;
  24.     Boolean        state;
  25.     
  26.     if ( control == nil )
  27.         return paramErr;
  28.  
  29.     state = !isDeterminate;    
  30.     err = SetControlData( control, 0, kControlProgressBarIndeterminateTag, sizeof( state ),
  31.             (Ptr)&state );
  32.     
  33.     return err;
  34. }
  35.  
  36. pascal OSStatus SetPushButtonDefaultState( ControlHandle control, Boolean isDefault )
  37. {
  38.     OSStatus    err;
  39.     
  40.     if ( control == nil )
  41.         return paramErr;
  42.  
  43.     err = SetControlData( control, 0, kControlPushButtonDefaultTag, sizeof( isDefault ),
  44.             (Ptr)&isDefault );
  45.     
  46.     return err;
  47. }
  48.  
  49. pascal OSStatus GetListBoxListHandle( ControlHandle control, ListHandle* list )
  50. {
  51.     Size        actualSize;
  52.     OSStatus    err;
  53.     
  54.     if ( control == nil )
  55.         return paramErr;
  56.         
  57.     if ( list == nil )
  58.         return paramErr;
  59.         
  60.     err = GetControlData( control, 0, kControlListBoxListHandleTag, sizeof( ListHandle ),
  61.              (Ptr)list, &actualSize );
  62.         
  63.     return err;
  64. }
  65.